com.cete.dynamicpdf
Class Page
Example : The following example shows how to use file open action.
import com.cete.dynamicpdf.*;
import com.cete.dynamicpdf.pageelements.*;
import com.cete.dynamicpdf.pageelements.forms.*;
public class MyClass {
public static void main(String args[]) {
// Create a PDF Document
Document document = new Document();
// Create page and add it to the document
Page page = new Page();
document.getPages().add(page);
Button button = new Button("btn", 50, 150, 100, 30);
button.setLabel("Click Here");
// Create a label
Label label1 = new Label("Click the button to open the specified file :", 50, 100, 300, 30);
// Add the label and button to the page
page.getElements().add(button);
page.getElements().add(label1);
// Create a file open action and assign to the button events.
FileOpenAction action = new FileOpenAction("[physicalpath]/DocumentA.pdf", FileLaunchMode.NewWindow);
button.getReaderEvents().setMouseUp(action);
// Save the PDF
document.draw( "[physicalpath]/MyDocument.pdf" );
}
}